/*
 * Copyright (c) 2021.版权所有高金磊
 */

package 领扣算法.A简单题.山峰数组的顶部;

public class Main {
    public int peakIndexInMountainArray(int[] arr) {
        int res = 0;
        for (int i = 1; i < arr.length - 1; i++) {
            if (arr[i] > arr[i + 1] && arr[i] > arr[i - 1])
                return i;
        }
        return -1;
    }
}
